/**
 * @param {number[]} nums
 * @param {number} k
 * @return {number[]}
 */
 var getAverages = function(nums, k) {
  const n = nums.length
  const sum = new Array(n)
  sum[0] = nums[0]
  for(let i = 1; i<n; i++){
    sum[i] = sum[i-1] + nums[i]
  }
  sum.unshift(0)
  const ret = new Array(n).fill(-1)
  for(let i = k; i<n-k; i++){
    ret[i] = (sum[i+k+1]-sum[i-k])/(2*k+1) >> 0
  }
  return ret
};